package com.Controls;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;

public class SuperChlorination {
	
	private final double dblSrkVol = 0.055;
	private final double dblVolPool = 155.74;
	private final int intTStrk = 30; // Signal time in ms for 1 stroke
	
	public void Shock() throws InterruptedException {
		// Lower pH? May take too long given prototype

		// Inject shittone of Cl
		GpioController gpio = GpioFactory.getInstance();
		GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(
				RaspiPin.GPIO_02, PinState.LOW);

		double dblVolShock = 10*dblVolPool/12.5/10/1.2;
		int intStrk = ((int) (dblVolShock/dblSrkVol));
		
		for (int i = 0; i < intStrk; i++) {
			pin.high();
			Thread.sleep(intTStrk);
			pin.low();
			Thread.sleep(100 - intTStrk);
		}
		
		// poll sensor until safe Cl levels reached
	}
}
